package com.ycp.erp.main.fragment;

import android.annotation.SuppressLint;
import android.view.View;
import android.widget.LinearLayout;

import com.jakewharton.rxbinding2.view.RxView;
import com.one.common.config.RouterPath;
import com.one.common.manager.RouterManager;
import com.one.common.model.extra.DefaultExtra;
import com.one.common.view.base.BaseFragment;
import com.ycp.erp.R;

import java.util.concurrent.TimeUnit;

import butterknife.BindView;

/**
 * Class Des:
 * Created by bjh on 2021/8/23.
 */
public class HomeFragment extends BaseFragment {
    @BindView(R.id.llWarehouseManager)
    LinearLayout llWarehouseManager;
    @BindView(R.id.llBrandManager)
    LinearLayout llBrandManager;
    @BindView(R.id.llCategoryManager)
    LinearLayout llCategoryManager;
    @BindView(R.id.llGoodsManager)
    LinearLayout llGoodsManager;
    @BindView(R.id.llProcurementWarehouse)
    LinearLayout llProcurementWarehouse;
    @BindView(R.id.llSupplier)
    LinearLayout llSupplier;
    @BindView(R.id.llCustomerManager)
    LinearLayout llCustomerManager;
    @BindView(R.id.llOutWarehouse)
    LinearLayout llOutWarehouse;
    @BindView(R.id.llMoveWarehouse)
    LinearLayout llMoveWarehouse;
    @BindView(R.id.llCheckWarehouse)
    LinearLayout llCheckWarehouse;
    @BindView(R.id.llBill)
    LinearLayout llBill;
    @BindView(R.id.llPrinter)
    LinearLayout llPrinter;
    @BindView(R.id.llRole)
    LinearLayout llRole;
    @BindView(R.id.llEmployeeManager)
    LinearLayout llEmployeeManager;
    @BindView(R.id.llStatisticalAnalysis)
    LinearLayout llStatisticalAnalysis;

    @Override
    protected void initPresenter() {

    }

    @Override
    public int getLayoutResId() {
        return R.layout.fragment_home;
    }

    @SuppressLint("CheckResult")
    @Override
    public void initView() {
        super.initView();
        //跳转
        RxView.clicks(llWarehouseManager).throttleFirst(500, TimeUnit.MILLISECONDS).subscribe(o -> {
            RouterManager.getInstance().go(RouterPath.WAREHOUSE_MANAGER);
        });
        RxView.clicks(llBrandManager).throttleFirst(500, TimeUnit.MILLISECONDS).subscribe(o -> {
            RouterManager.getInstance().go(RouterPath.BRAND_MANAGER);
        });
        RxView.clicks(llCategoryManager).throttleFirst(500, TimeUnit.MILLISECONDS).subscribe(o -> {
            RouterManager.getInstance().go(RouterPath.CATEGORY_MANAGER);
        });
        RxView.clicks(llGoodsManager).throttleFirst(500, TimeUnit.MILLISECONDS).subscribe(o -> {
            RouterManager.getInstance().go(RouterPath.GOODS_MANAGER);
        });
        RxView.clicks(llProcurementWarehouse).throttleFirst(500, TimeUnit.MILLISECONDS).subscribe(o -> {
            RouterManager.getInstance().go(RouterPath.PROCURE_WAREHOUSE);
        });
        RxView.clicks(llSupplier).throttleFirst(500, TimeUnit.MILLISECONDS).subscribe(o -> {
            RouterManager.getInstance().go(RouterPath.SUPPLIER_MANAGER);
        });
        RxView.clicks(llCustomerManager).throttleFirst(500, TimeUnit.MILLISECONDS).subscribe(o -> {
            RouterManager.getInstance().go(RouterPath.CUSTOMER_MANAGER);
        });
        RxView.clicks(llOutWarehouse).throttleFirst(500, TimeUnit.MILLISECONDS).subscribe(o -> {
            RouterManager.getInstance().go(RouterPath.OUT_WAREHOUSE);
        });
        RxView.clicks(llMoveWarehouse).throttleFirst(500, TimeUnit.MILLISECONDS).subscribe(o -> {
            RouterManager.getInstance().go(RouterPath.MOVE_WAREHOUSE);
        });
        RxView.clicks(llCheckWarehouse).throttleFirst(500, TimeUnit.MILLISECONDS).subscribe(o -> {
            RouterManager.getInstance().go(RouterPath.CHECK_WAREHOUSE);
        });
        RxView.clicks(llBill).throttleFirst(500, TimeUnit.MILLISECONDS).subscribe(o -> {
            RouterManager.getInstance().go(RouterPath.BILL_MANAGER);
        });
        RxView.clicks(llPrinter).throttleFirst(500, TimeUnit.MILLISECONDS).subscribe(o -> {
            RouterManager.getInstance().go(RouterPath.PRINTER_MANAGER,new DefaultExtra(2));
        });
        RxView.clicks(llRole).throttleFirst(500, TimeUnit.MILLISECONDS).subscribe(o -> {
            RouterManager.getInstance().go(RouterPath.ROLE_MANAGER);
        });
        RxView.clicks(llEmployeeManager).throttleFirst(500, TimeUnit.MILLISECONDS).subscribe(o -> {
            RouterManager.getInstance().go(RouterPath.EMPLOYEE_MANAGER);
        });
        RxView.clicks(llStatisticalAnalysis).throttleFirst(500, TimeUnit.MILLISECONDS).subscribe(o -> {
            RouterManager.getInstance().go(RouterPath.STATISTICAL_ANALYSIS);
        });
    }
}
